﻿/*
 * @Autor: 黄旗
 * @Date: 2020-06-12 08:32:30
 */
import request from '@/plugins/request';
import dayjs from 'dayjs';

// 设备列表
export function settingphonephonelist(data) {
    return request({
        url: '/v1/setting/phone/phone-list',
        method: 'get',
        params: data
    });
}
// 设备新增
export function settingphonephoneadd(data) {
    return request({
        url: '/v1/setting/phone/phone-add',
        method: 'post',
        data
    });
}
// 设备更新
export function settingphonephoneupdate(data) {
    return request({
        url: '/v1/setting/phone/phone-update',
        method: 'post',
        data
    });
}
// 设备信息
export function settingphonephoneinfo(data) {
    return request({
        url: '/v1/setting/phone/phone-info',
        method: 'get',
        params: data
    });
}
// 自动化-流程设置
export function automationflowindex(data) {
    return request({
        url: '/v1/automation/flow/index',
        method: 'get',
        params: data
    });
}
// 设备更新
export function automationflowupdateflow(data) {
    return request({
        url: '/v1/automation/flow/update-flow',
        method: 'post',
        data
    });
}
// 获取诊室列表
export function settingclinicview(data) {
    return request({
        url: '/v1/setting/clinic/view',
        method: 'get',
        params: data
    });
}
// 添加诊室
export function settingclinicadd(data) {
    return request({
        url: '/v1/setting/clinic/add',
        method: 'post',
        data
    });
}
// 编辑诊室
export function settingclinicedit(data) {
    return request({
        url: '/v1/setting/clinic/edit',
        method: 'post',
        data
    });
}
// 鱼池列表
export function patientindexfishlist(data) {
    let datas = data;
    if(data.export_stime) {
        datas.export_stime = dayjs(data.export_stime).format('YYYY-MM-DD');
        datas.export_etime = dayjs(data.export_etime).format('YYYY-MM-DD');
    }
    if(data.created_stime) {
        datas.created_stime = dayjs(data.created_stime).format('YYYY-MM-DD');
        datas.created_etime = dayjs(data.created_etime).format('YYYY-MM-DD');
    }
    return request({
        url: '/v1/patient/index/fish-list',
        method: 'get',
        params: datas
    });
}
// 鱼池分配
export function patientindexfishallot(data) {
    return request({
        url: '/v1/patient/index/fish-allot',
        method: 'post',
        data
    });
}
// 公海列表
export function patientindexsealist(data) {
    let datas = data;
    if(data.export_stime) {
        datas.export_stime = dayjs(data.export_stime).format('YYYY-MM-DD');
        datas.export_etime = dayjs(data.export_etime).format('YYYY-MM-DD');
    }
    if(data.created_stime) {
        datas.created_stime = dayjs(data.created_stime).format('YYYY-MM-DD');
        datas.created_etime = dayjs(data.created_etime).format('YYYY-MM-DD');
    }
    return request({
        url: '/v1/patient/index/sea-list',
        method: 'get',
        params: datas
    });
}
// 公海分配
export function patientindexseaallot(data) {
    return request({
        url: '/v1/patient/index/sea-allot',
        method: 'post',
        data
    });
}
// 获取下拉信息
export function cluecallselectinfo(data) {
    return request({
        url: '/v1/clue/call/select-info',
        method: 'get',
        params: data
    });
}
// 获取列表
export function cluecalllist(data) {
    let datas = data;
    if(data.start_time) {
        datas.start_time = dayjs(data.start_time).format('YYYY-MM-DD');
        datas.end_time = dayjs(data.end_time).format('YYYY-MM-DD');
    }
    return request({
        url: '/v1/clue/call/list',
        method: 'get',
        params: datas
    });
}
// 联系线索（来电线索中的联系线索）
export function cluecallcontact(data) {
    return request({
        url: '/v1/clue/call/contact',
        method: 'post',
        data
    });
}
// 联系线索111
export function getCluecallcontact(data) {
    return request({
        url: '/v1/clue/call/contact-results',
        method: 'get',
        params: data
    });
}
// 分配列表
export function patientindexallotlist(data) {
    let datas = data;
    if(data.created_stime) {
        datas.created_stime = dayjs(data.created_stime).format('YYYY-MM-DD');
        datas.created_etime = dayjs(data.created_etime).format('YYYY-MM-DD');
    }
    return request({
        url: '/v1/patient/index/allot-list',
        method: 'get',
        params: datas
    });
}
// 患者分配
export function patientindexallot(data) {
    let datas = data;
    if(data.created_stime) {
        datas.created_stime = dayjs(data.created_stime).format('YYYY-MM-DD');
        datas.created_etime = dayjs(data.created_etime).format('YYYY-MM-DD');
    }
    return request({
        url: '/v1/patient/index/allot',
        method: 'post',
        data: datas
    });
}
// 解绑
export function removeDingtalk(data) {
    return request({
        url: '',
        method: 'post',
        data
    });
}
// 获取标签列表
export function basetagsindex(data) {
    return request({
        url: '/v1/base/tags/index',
        method: 'get',
        params: data
    });
}
// 新增标签
export function basetagscreate(data) {
    return request({
        url: '/v1/base/tags/create',
        method: 'post',
        data
    });
}
// 编辑标签
export function basetagsupdate(data) {
    return request({
        url: '/v1/base/tags/update',
        method: 'post',
        data
    });
}
// 删除标签
export function basetagstagsdel(data) {
    return request({
        url: '/v1/base/tags/tags-del',
        method: 'post',
        data
    });
}
// 微信列表
export function customerwechatlist(data) {
    return request({
        url: '/v1/customer/wechat/list',
        method: 'get',
        params: data
    });
}
// 微信好友列表
export function customerwechatcontactlist(data) {
    let datas = data;
    if(data.date) {
        datas.date = dayjs(data.date).format('YYYY-MM-DD');
    }
    return request({
        url: '/v1/customer/wechat/contact-list',
        method: 'get',
        params: datas
    });
}
// 微信好友聊天列表
export function customerwechatmessagelist(data) {
    let datas = data;
    if(data.date) {
        datas.date = dayjs(data.date).format('YYYY-MM-DD');
    }
    return request({
        url: '/v1/customer/wechat/message-list',
        method: 'get',
        params: datas
    });
}
// 转换格式
export function customerwechatconverfile(data) {
    return request({
        url: '/v1/customer/wechat/conver-file',
        method: 'post',
        data
    });
}
// 获取个人信息
export function rbacmemberselfinfo(data) {
    return request({
        url: '/v1/rbac/member/self-info',
        method: 'get',
        params: data
    });
}
// 编辑个人信息
export function rbacmembereditinfo(data) {
    return request({
        url: '/v1/rbac/member/edit-info',
        method: 'post',
        data
    });
}
// 修改密码
export function rbacmemberchangepassword(data) {
    return request({
        url: '/v1/rbac/member/change-password',
        method: 'post',
        data
    });
}

// 回访报表
export function statisticscallbackreportcallbackreport(data) {
    let datas = data;
    if(data.start_time) {
        datas.start_time = dayjs(data.start_time).format('YYYY-MM-DD');
        datas.end_time = dayjs(data.end_time).format('YYYY-MM-DD');
    }
    return request({
        url: '/v1/statistics/callback-report/callback-report',
        method: 'get',
        params: datas
    });
}
// 回访报表
export function statisticscallbackreportcallbackreportdetail(data) {
    let datas = data;
    if(data.start_time) {
        datas.start_time = dayjs(data.start_time).format('YYYY-MM-DD');
        datas.end_time = dayjs(data.end_time).format('YYYY-MM-DD');
    }
    return request({
        url: '/v1/statistics/callback-report/callback-report-detail',
        method: 'get',
        params: datas
    });
}
// 市场转诊
export function patientmarketpatientlist(data) {
    let datas = data;
    if(data.start_time) {
        datas.start_time = dayjs(data.start_time).format('YYYY-MM-DD');
        datas.end_time = dayjs(data.end_time).format('YYYY-MM-DD');
    }
    return request({
        url: '/v1/patient/market/patient-list',
        method: 'get',
        params: datas
    });
}
// 推广计划列表
export function settingpromotionindex(data) {
    return request({
        url: '/v1/setting/promotion/index',
        method: 'get',
        params: data
    });
}
// 推广计划添加
export function settingpromotionadd(data) {
    return request({
        url: '/v1/setting/promotion/add-promotion',
        method: 'post',
        data
    });
}
// 推广计划编辑
export function settingpromotionupdate(data) {
    return request({
        url: '/v1/setting/promotion/update',
        method: 'post',
        data
    });
}
// 删除推广计划
export function settingpromotiondel(data) {
    return request({
        url: '/v1/setting/promotion/del',
        method: 'post',
        data
    });
}
// 删除患者列表【回收站】
export function patientindexdeletelist(data) {
    let datas = data;
    if(data.delete_stime) {
        datas.delete_stime = dayjs(data.delete_stime).format('YYYY-MM-DD');
        datas.delete_etime = dayjs(data.delete_etime).format('YYYY-MM-DD');
    }
    if(data.created_stime) {
        datas.created_stime = dayjs(data.created_stime).format('YYYY-MM-DD');
        datas.created_etime = dayjs(data.created_etime).format('YYYY-MM-DD');
    }
    return request({
        url: '/v1/patient/index/delete-list',
        method: 'get',
        params: datas
    });
}
// 还原患者
export function patientindexrestoredelete(data) {
    return request({
        url: '/v1/patient/index/restore-delete',
        method: 'post',
        data
    });
}
// 物理删除标签/标签组以及绑定的患者标签
export function deleteGroupTag(data) {
    return request({
        url: '/v1/base/tags/delete-tags-group',
        method: 'post',
        data
    });
}

// 添加患者病历图片
export function patientindexaddmedicalimg(data) {
    return request({
        url: '/v1/patient/index/add-medical-img',
        method: 'post',
        data
    });
}

// 视图删除
export function settingviewdeleteview(data) {
    return request({
        url: '/v1/data/setting-view/delete-view',
        method: 'post',
        data
    });
}

// 新增/ 编辑视图
export function settingviewcreateview(data) {
    let datas = data;
    if(data.start_time) {
        datas.start_time = dayjs(data.start_time).format('YYYY-MM-DD');
        datas.end_time = dayjs(data.end_time).format('YYYY-MM-DD');
    }
    return request({
        url: '/v1/data/setting-view/create-view',
        method: 'post',
        data: datas
    });
}

// 视图列表
export function settingviewviewlist(data) {
    let datas = data;
    if(data.start_time) {
        datas.start_time = dayjs(data.start_time).format('YYYY-MM-DD');
        datas.end_time = dayjs(data.end_time).format('YYYY-MM-DD');
    }else {
        datas.start_time = '';
        datas.end_time = '';
    }
    return request({
        url: '/v1/data/setting-view/view-list',
        method: 'get',
        params: datas
    });
}

// 视图列表
export function settingviewviewcallback(data) {
    let datas = data;
    if(data.start_time) {
        datas.start_time = dayjs(data.start_time).format('YYYY-MM-DD');
        datas.end_time = dayjs(data.end_time).format('YYYY-MM-DD');
    }else {
        datas.start_time = '';
        datas.end_time = '';
    }
    return request({
        url: '/v1/data/setting-view/view-callback',
        method: 'get',
        params: datas
    });
}

// 视图列表
export function settingviewviewcallbacktimes(data) {
    let datas = data;
    if(data.start_time) {
        datas.start_time = dayjs(data.start_time).format('YYYY-MM-DD');
        datas.end_time = dayjs(data.end_time).format('YYYY-MM-DD');
    }else {
        datas.start_time = '';
        datas.end_time = '';
    }
    return request({
        url: '/v1/data/setting-view/view-callback-times',
        method: 'get',
        params: datas
    });
}

// 动态视图详情
export function settingviewdynamicdetail(data) {
    return request({
        url: '/v1/data/setting-view/dynamic-detail',
        method: 'get',
        params: data
    });
}

// 常规视图详情
export function settingviewnormaldetail(data) {
    return request({
        url: '/v1/data/setting-view/normal-detail',
        method: 'get',
        params: data
    });
}

// 筛选条件
export function settingviewgetparamslist(data) {
    return request({
        url: '/v1/data/setting-view/get-params-list',
        method: 'get',
        params: data
    });
}

// 编辑参数返回
export function settingvieweditviewcondition(data) {
    return request({
        url: '/v1/data/setting-view/edit-view-condition',
        method: 'get',
        params: data
    });
}

// 动态视图患者数
export function settingviewpatienttotal(data) {
    let datas = data;
    if(data.start_time) {
        datas.start_time = dayjs(data.start_time).format('YYYY-MM-DD');
        datas.end_time = dayjs(data.end_time).format('YYYY-MM-DD');
    }else {
        datas.start_time = '';
        datas.end_time = '';
    }
    return request({
        url: '/v1/data/setting-view/patient-total',
        method: 'get',
        params: datas
    });
}

// 完善率报表列表
export function statisticsinformationreportindexreport(data) {
    let datas = data;
    if(data.start_time) {
        datas.start_time = dayjs(data.start_time).format('YYYY-MM-DD');
        datas.end_time = dayjs(data.end_time).format('YYYY-MM-DD');
    }
    return request({
        url: '/v1/statistics/information-report/index-report',
        method: 'get',
        params: datas
    });
}

// 客服报表
export function serviceReportList(data) {
    let datas = data;
    if(data.start_time) {
        datas.start_time = dayjs(data.start_time).format('YYYY-MM-DD');
        datas.end_time = dayjs(data.end_time).format('YYYY-MM-DD');
    }
    return request({
        url: '/v1/statistics/customer-report/customer-report',
        method: 'get',
        params: datas
    });
}
// 重复患者详情
export function serviceReportListC(data) {
    return request({
        url: '/v1/statistics/customer-report/report-detail',
        method: 'get',
        params: data
    });
}
// 鱼池筛选条件
export function patientindexfishcondition(data) {
    return request({
        url: '/v1/patient/index/fish-condition',
        method: 'get',
        params: data
    });
}
// 创建同步微信好友队列
export function wechatfriendQueue(data) {
    return request({
        url: '/v1/site/repair-wechat-friend-queue',
        method: 'get',
        params: data
    });
}
// 创建同步微信好友聊天记录
export function wechatmessageQueue(data) {
    return request({
        url: '/v1/site/repair-wechat-message-queue',
        method: 'get',
        params: data
    });
}
// 创建同步录音
export function voiceQueue(data) {
    return request({
        url: '/v1/site/create-voice-queue',
        method: 'get',
        params: data
    });
}
// 创建同步微信好友聊天大图记录
export function wechatmessagefileQueue(data) {
    return request({
        url: 'v1/site/repair-wechat-message-file-queue',
        method: 'get',
        params: data
    });
}
// 设备删除
export function phoneDel(data) {
    return request({
        url: '/v1/setting/phone/phone-del',
        method: 'get',
        params: data
    });
}
// 查看消息详情
export function wechatMessageInfo(data) {
    return request({
        url: 'v1/robot/index/message-info',
        method: 'get',
        params: data
    });
}